#pragma once


typedef HRESULT (*PFNPredicate)(XCHAR);


class XamlNameParser
{
public: 
	XamlNameParser(const xshared_ptr<CXString const > & input);
protected: 
	XUINT32 ParsePrefix(xshared_ptr<CXString> & outPrefix);
	XUINT32 ParseName(xshared_ptr<CXString> & outName);
	XUINT32 ParseSingleDottedName(xshared_ptr<CXString> & outssBeforeDot, xshared_ptr<CXString> & outssAfterDot);
	XUINT32 ParseUndottedName(xshared_ptr<CXString> & outssName);
	XUINT32 ParseUndottedName(xshared_ptr<CXString> & outssBeforeDot, xshared_ptr<CXString> & outssAfterDot);
	XUINT32 ParsePredicate(PFNPredicate Predicate);
	XUINT32 ParseChar(XCHAR ch);
	XUINT32 ParseXmlNameFirstChar();
	XUINT32 ParseXmlNameChar();
	XUINT32 Seq(XUINT32 uStartIndex, XBOOL bWasSuccess);
	XUINT32 ParseRestOfName();
	XUINT32 ParseRestOfPrefix();
	static XBOOL IsColon(XCHAR ch);
	XBOOL ParseEmpty();
	static XBOOL IsXmlPrefixChar(XCHAR ch);
	static XBOOL IsValidXmlNameFirstChar(XCHAR ch);
	static XBOOL IsValidXmlNameChar(XCHAR ch);

protected: 
	XUINT32 m_uIndex;
	xshared_ptr<CXString const > m_ssInput; 


};

